@extends('home.shihuo.layout.layout')
@section('title',$details->gptitle)

@section('cont')

<div class="content-bg">
    <div class="content">
        <div class="details-discount clearfix">
            <div class="area-prolist">

                <!-- 文章主要内容 -->
                <div class="frame">
                    <h2 class="article-title">
                        <i class="column-name">{{$details->gpoint}}</i>
                        {{$details->gptitle}}
                    </h2>
                    <div class="info clearfix">
                        <div class="record fl">{{$details->username}} 发表于：{{$details->gpctime}}</div>
                        <div class="space-line fl">|</div>
                        <div class="bottom fl clearfix">
                            <div class="left J_message_fn_tip" data-message-id="191851">
                                <a class="z btn-recommend J_message_btn_recommend" href="javascript:" rel="nofollow">
                                    <span class="recommend-num wenzhang">{{$details->gplike}}</span></a>
                                <a class="say" href="#message_replies">{{$gpcnum->gpcnum}}</a>
                            </div>
                        </div>
                    </div>
                    <div class="article">
                        <div class="going-shop-area clearfix" style="display:none;">
                            <script type="text/javascript">$(function() {
                                    getShopData.init({
                                        type: "youhui",
                                        obj: $(".going-shop-area"),
                                        tid: ""
                                    });
                                });
                            </script>
                        </div>
                        <div class="con clearfix editor-frame frame">
                            {!! $details->gpcont !!}
                            <input type="hidden" name="gpid" value="{{$details->gpid}}">
                        </div>
                    </div>
                </div>
                <!-- 文章主要内容 -->

                <a href="#" name="message_replies"></a>

                <!-- 评论 -->
                <div style="margin-top:10px;" class="comment">
                    <div name="sh-comment-a" class="shihuo-comment-area">
                        <div class="sh-com-tit clearfix">
                            <div class="sh-com-tit-main">评论({{$gpcnum->gpcnum}})</div>
                            <div class="sh-com-tit-sub">
                                <i>
                                </i>立即评价</div>
                        </div>
                        <div class="sh-com-tit-border"></div>
                        <div id="shihuo-comment-edit">
                            <div class="shihuo-comment-edit-head">
                                <img src="{{session('pic')}}"></div>
                            <div class="shihuo-comment-edit-txt-box">
                                <!-- 加判断 用户是否登录 -->
                                @if(session('uid'))
                                <div id="shihuo-comment-edit-txt">
                                    <div id="shihuo-comment-edit-frame">
                                        <textarea class="gpcomments" placeholder="快来发表评论吧" style="width:100%; height:100px; border:0px; padding:5px;"></textarea>
                                    </div>
                                    <div class="up-loding-img clearfix">
                                        <ul id="shihuo-comment-img-ul"></ul>
                                        <div class="shihuo-comment-edit-submit-border"></div>
                                        <input type="submit" value="评论" class="shihuo-comment-edit-submit">
                                    </div>
                                </div>
                                @else
                                <div id="shihuo-comment-edit-txt">
                                    <div id="shihuo-comment-edit-frame">
                                        <textarea disabled class="gpcomments" style="width:100%; height:100px; border:0px; padding:5px;"></textarea>
                                    </div>
                                    <div class="up-loding-img clearfix">
                                        <ul id="shihuo-comment-img-ul"></ul>
                                        <div class="shihuo-comment-edit-submit-border"></div>
                                        <input type="submit" disabled value="评论" class="shihuo-comment-edit-submit">
                                    </div>
                                </div>
                                <div id="shihuo-comment-edit-txt" style="height:50px;line-height:50px;text-align:center;">
                                    <div id="shihuo-comment-edit-frame">
                                        您需要登录才能发表评论,点击&nbsp;
                                        <a href="{{url('/home/login/login')}}">&nbsp;登录&nbsp;</a>&nbsp;或点击&nbsp;
                                        <a href="{{url('/home/login/regist')}}">&nbsp;注册&nbsp;</a>
                                    </div>
                                </div>
                                @endif

                            </div>
                        </div>
                        <div id="shihuo-all-comment-conent">
                            <div class="sh-com-all-area">
                                <ul id="shihuo-comment-content">
                                    @foreach($gpcomments as $k=>$v)
                                    <li class="gpcomment" gpcomment="{{$v->gpcid}}">
                                        <div class="sh-com-list-main">
                                            <img src="{{asset($v->pic)}}"></div>
                                        <div class="sh-com-list-sub">
                                            <div class="sh-com-lis-name clearfix">
                                                <div class="name">{{$v->username}}</div>
                                                <div class="floor">{{$k+1}}楼</div>
                                            </div>
                                            <div class="sh-com-lis-txt">
                                                {!! $v->gpcont !!}
                                                <input type="hidden" name="gpcid" value="{{$v->gpcid}}">
                                            </div>
                                            <div class="sh-com-lis-tips clearfix">
                                                <div class="time-box">{{$v->gpctime}}</div>
                                                <div class="tips-box">
                                                    <a class="z btn-recommend J_message_btn_recommend" href="javascript:" rel="nofollow">
                                                        <span class="recommend-num pinglun">赞&nbsp;:&nbsp;{{$v->gpclike}}</span>
                                                    </a>
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                    @endforeach
                                </ul>
                            </div>
                            <div allpage="1" class="shihuo-comment-pages lastCommentPages"></div>

                        </div>
                    </div>
                </div>
                <!-- 评论 -->


            </div>
            <div class="area-subbox">
                <div class="right-list-box">
                    <div class="title-sub">识货推荐</div>
                    <ul class="list1">
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a href="http://www.shihuo.cn/youhui/251971.html#qk=tuijian&order=1" title="涂鸦系列！New Balance男子休闲鞋MRT580HD/HC">
                                        <img src="picture/5dd0020c2aa855ef754fdea06fe91bd6.jpg" width="70"></a>
                                </div>
                                <div class="t2">
                                    <a href="http://www.shihuo.cn/youhui/251971.html#qk=tuijian&order=1" title="涂鸦系列！New Balance男子休闲鞋MRT580HD/HC">涂鸦系列！New Balance男子休闲鞋MRT580HD/HC</a>
                                    <p class="r">389元包邮（需用券）</p></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a href="http://www.shihuo.cn/youhui/251973.html#qk=tuijian&order=2" title="轰趴必备！LOGOS 乐格氏 铁质立式烤炉M号">
                                        <img src="picture/d7d7f4e707e0e74afe89e0a707863578.jpg" width="70"></a>
                                </div>
                                <div class="t2">
                                    <a href="http://www.shihuo.cn/youhui/251973.html#qk=tuijian&order=2" title="轰趴必备！LOGOS 乐格氏 铁质立式烤炉M号">轰趴必备！LOGOS 乐格氏 铁质立式烤炉M号</a>
                                    <p class="r">网易考拉259元包邮</p></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a href="http://www.shihuo.cn/youhui/251879.html#qk=tuijian&order=3" title="历史好价！优衣库摇粒绒起居套装(长袖) 179968">
                                        <img src="picture/8efd4b2a4743e3e96dd9ffc1a78c5b89.jpg" width="70"></a>
                                </div>
                                <div class="t2">
                                    <a href="http://www.shihuo.cn/youhui/251879.html#qk=tuijian&order=3" title="历史好价！优衣库摇粒绒起居套装(长袖) 179968">历史好价！优衣库摇粒绒起居套装(长袖) 179968</a>
                                    <p class="r">99元</p></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a href="http://www.shihuo.cn/youhui/251810.html#qk=tuijian&order=4" title="轻量灵活！新百伦 中性 休闲跑步鞋 MRL999AG-D">
                                        <img src="picture/ec4f5923b2d3cb89fb41fcf3ebab84c7.jpg" width="70"></a>
                                </div>
                                <div class="t2">
                                    <a href="http://www.shihuo.cn/youhui/251810.html#qk=tuijian&order=4" title="轻量灵活！新百伦 中性 休闲跑步鞋 MRL999AG-D">轻量灵活！新百伦 中性 休闲跑步鞋 MRL999AG-D</a>
                                    <p class="r">608.3元包邮</p></div>
                            </div>
                        </li>
                    </ul>
                </div>

                <div class="right-list-box hot-list-box">
                    <div class="title-sub">热门专题</div>
                    <ul class="list1">
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1836.html#qk=topic" title="年终盘点 | 2016年度十大实战球鞋榜单">
                                        <img src="picture/b0c11b49021fa1c91067ed7cdd1446ae.jpg" width="50"></a>
                                </div>
                                <div class="t2">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1836.html#qk=topic" title="年终盘点 | 2016年度十大实战球鞋榜单">年终盘点 | 2016年度十大实战球鞋榜单</a></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1926.html#qk=topic" title="年度大总结，盘点2016球鞋十宗&ldquo;最&rdquo;">
                                        <img src="picture/640x640_c0d3a67224fdc618ad564ebdd155053a.jpeg" width="50"></a>
                                </div>
                                <div class="t2">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1926.html#qk=topic" title="年度大总结，盘点2016球鞋十宗&ldquo;最&rdquo;">年度大总结，盘点2016球鞋十宗&ldquo;最&rdquo;</a></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1914.html#qk=topic" title="圣诞大战再无科比&mdash;&mdash;科比十六次圣诞大战和脚上战靴全回顾">
                                        <img src="picture/1024x1024_3474b291def8e02d7be203760866950d.jpeg" width="50"></a>
                                </div>
                                <div class="t2">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1914.html#qk=topic" title="圣诞大战再无科比&mdash;&mdash;科比十六次圣诞大战和脚上战靴全回顾">圣诞大战再无科比&mdash;&mdash;科比十六次圣诞大战和脚上战靴全回顾</a></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1917.html#qk=topic" title="熬夜轰趴开黑蓬头垢面？几步让你三分钟清爽出门！">
                                        <img src="picture/aa245fadc42070d4f1149ec1385d72af.jpg" width="50"></a>
                                </div>
                                <div class="t2">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1917.html#qk=topic" title="熬夜轰趴开黑蓬头垢面？几步让你三分钟清爽出门！">熬夜轰趴开黑蓬头垢面？几步让你三分钟清爽出门！</a></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1899.html#qk=topic" title="I can do all things丨细数与库里有关的装备之球鞋篇">
                                        <img src="picture/8ebce3f8ac1150d69bf63c4b6d7095d0.jpg" width="50"></a>
                                </div>
                                <div class="t2">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1899.html#qk=topic" title="I can do all things丨细数与库里有关的装备之球鞋篇">I can do all things丨细数与库里有关的装备之球鞋篇</a></div>
                            </div>
                        </li>
                        <li>
                            <div class="clearfix">
                                <div class="t1">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1861.html#qk=topic" title="你值得等待&mdash;&mdash;2017年最期待复刻篮球鞋大猜想">
                                        <img src="picture/50079380a0c03f9e3e86ab78c9bd684d.jpg" width="50"></a>
                                </div>
                                <div class="t2">
                                    <a target="_blank" href="http://www.shihuo.cn/article/detail/1861.html#qk=topic" title="你值得等待&mdash;&mdash;2017年最期待复刻篮球鞋大猜想">你值得等待&mdash;&mdash;2017年最期待复刻篮球鞋大猜想</a></div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 进度框 -->
<div class="bar-fixed-top coverbox" id="fixedTop">
    <div class="con">
        <a isconvert=1 class="fl" href="javascript::void(0)">
            <img src="{{asset($details->pic)}}" width="48" alt="" />
        </a>
        <b>
            <i class="column-name">{{$details->gpoint}}</i>
            {{$details->gptitle}}
        </b>
        <a isconvert=1 id="dianjishoucang" class="btn-gobuy bottom-sub" type="button">点击收藏本文</a>
    </div>
    <div class="bottombox">
        <span class="scrollline"></span>
    </div>
</div>
<!-- 进度框 -->


@endsection

@section('js')

<script type="text/javascript">function taobaokeShopDaceStatistics(){
        //按钮点击统计
        __dace.sendEvent('shihuo_taobaoke_shop_youhui_detail_191851');
    }
    returnTop.init();
    var w_h = getW().h;
    var fixedTop = {
        init: function() {
            this.fixedTop = $("#fixedTop");
            this.fixedTui = $("#fixedTui");
            this.fixedTop.hide();
            var that = this;
            var $frame = $(".frame");
            var scrollw = 1080;
            $(window).bind("scroll",
            function() {
                var w_t = getW().s;
                var moveratio = ($(window).scrollTop() - $frame.offset().top) / $frame.height();
                w_t > 360 ? (that.fixedTop.fadeIn(), $(".scrollline").css({
                    "width": Math.round(moveratio * scrollw) + "px"
                })) : that.fixedTop.fadeOut(); //顶部商品bar购买
                w_t > 960 ? that.fixedTui.fadeIn() : that.fixedTui.fadeOut(); //识货推荐
                if ($(window).scrollTop() >= $(document).height() - $(window).height()) {
                    if (w_h < 800) {
                        that.fixedTop.fadeOut();
                    }
                }
            });
        }
    };

    var fixedBox = {
        init: function() {
            this.fixedTop = $("#fixedBox");
            var that = this;
            topThat = null;
            var topleft = $(".bar-fiex-left").offset().top;
            $(window).bind("scroll",
            function() { ! topThat && (topThat = that.fixedTop.offset().top);
                //顶部商品bar购买
                var w_t = getW().s;
                var show = ($(document).height() - $(window).scrollTop()) > 1000 ? true: false;

                if ($(window).scrollTop() >= topleft) {
                    $(".bar-fiex-left").addClass("fixed");
                } else {
                    $(".bar-fiex-left").removeClass("fixed");
                }
                if ($(window).scrollTop() > topThat) {
                    that.fixedTop.addClass("right-list-fixed");
                } else {
                    that.fixedTop.removeClass("right-list-fixed");
                }
            });
        }
    };

    if (w_h < 660) {
        if ($("#fixedTui .list1 li").length >= 5) {
            $("#fixedTui .list1 li").eq(3).css("border", "none");
            $("#fixedTui .list1 li").eq(4).hide();
            $("#fixedTui .list1 li").eq(5).hide();
        }
    }
    fixedTop.init();
    $(window).load(function() {
        fixedBox.init();
    });
    $(function() {
        $(".comment").shihuoComment({
            typeId: 1,
            productId: '191851',
            page: 1,
            light: true,
            msgCommentId: '0',
            msgReplyId: '0'
        });
        var _title = $(".article-title").text();
        var _content = "";
        var _url = document.URL;

        if ($.browser.msie && $.browser.version < 9) {
            $('#qrcode').qrcode({
                render: 'table',
                width: 100,
                height: 100,
                text: _url
            });
        } else {
            $('#qrcode').qrcode({
                render: 'canvas',
                width: 100,
                height: 100,
                text: _url
            });
        }

        short_cart.init(product_id);
    });

    // 获取帖子ID
    var gpid = $('input[name=gpid]').val();

    // 绑定单击事件  添加评论
    $('.shihuo-comment-edit-submit').click(function(){
        // 获取用户输入内容
        var gpcont = $('.gpcomments').val();
        $.ajax({
            url:'{{url('/home/shiwu/comment')}}',
            data:{gpid:gpid,gpcont:gpcont},
            type:'get',
            success:function(data){
                eval('var pl = '+data);
                var str = '<li class="gpcomment" gpcomment="'+pl[0].gpid+'"> <div class="sh-com-list-main"> <img src="{{asset(session("pic"))}}"></div> <div class="sh-com-list-sub"> <div class="sh-com-lis-name clearfix"> <div class="name">'+pl[0].username+'</div> <div class="floor">楼</div> </div> <div class="sh-com-lis-txt"> '+gpcont+'</div> <div class="sh-com-lis-tips clearfix"> <div class="time-box">'+pl[0].gpctime+'</div> <div class="tips-box"> <span gpcomment="'+pl[0].gpcid+'" class="t1"> <i> </i>'+pl[0].gpclike+'</span> </div> </div> </div> </li>';
                $('#shihuo-comment-content').append(str);
                $('.gpcomments').val('');
            },
            error:function(){
                console.log('ajax错误');
            },
            timeout:3000,
            async:false
        })
    })


    var LOGIN = false;
    // 判断用户是否登录
    $.ajax({
        url:'{{url('/home/shiwu/sfdl')}}',
        type:'get',
        success:function(data){
            if(data == 1){
                LOGIN = true;
            }
        },
        error:function(){
            console.log('ajax错误');
        },
        timeout:3000,
        async:false
    })

    // 判断用户是否登录
    function login()
    {
       if(LOGIN == false){
            alert('请先登录');
            location.href = "{{url('/home/login/login')}}";
       }
    }


    // 若已登录,判断用户是否已收藏
    if(LOGIN == true){
        $.ajax({
            url:'{{url('/home/shiwu/sfsc')}}',
            data:{gpid:gpid},
            type:'get',
            success:function(data){
                if(data == 1){
                    $('#dianjishoucang').html('已收藏');
                }
            },
            error:function(){
                console.log('ajax错误');
            },
            timeout:3000,
            async:false
        })
    }
    

    // 绑定单击事件 添加收藏
    $('#dianjishoucang').click(function(){
        // 用户是否登录
        login();

        if(LOGIN == false){
            return false;
        }

        // 用户是否收藏
        if($('#dianjishoucang').html() == '已收藏'){
            return false;
        }
        // 发送ajax 添加收藏
        $.ajax({
            url:'{{url('/home/shiwu/shoucang')}}',
            data:{gpid:gpid},
            type:'get',
            success:function(data){
                if(data == 1){
                    $('#dianjishoucang').html('已收藏');
                }
            },
            error:function(){
                console.log('ajax错误');
            },
            timeout:3000,
            async:false
        })
    })
    
    // 绑定单击事件给文章点赞
    $('.wenzhang').click(function(){
        $.ajax({
            url:'{{url('/home/shiwu/wenzhangzan')}}',
            data:{gpid:gpid},
            type:'get',
            success:function(data){
                eval('var a ='+data)
                $('.wenzhang').html(a[0].gplike);
            },
            error:function(){
                console.log('ajax错误');
            },
            timeout:3000,
            async:false
        })
    })

    // 绑定单击事件给评论点赞
    $('.pinglun').click(function(){
        var gpcid = $(this).parents('div').find('input').val();
        var inp = $(this);
        $.ajax({
            url:'{{url('/home/shiwu/pinglunzan')}}',
            data:{gpcid:gpcid},
            type:'get',
            success:function(data){
                eval('var a ='+data);
                inp.html('赞&nbsp;:&nbsp;'+a[0].gpclike);
            },
            error:function(){
                console.log('ajax错误');
            },
            timeout:3000,
            async:false
        })
    })

    
</script>

@endsection




